
package com.eyedog.video.videolist;

import com.eyedog.video.entity.VideoEntity;
import com.eyedog.video.http.ICallback;

import java.util.HashMap;
import java.util.List;

public class DataHolder {

    private DataHolder() {
    }

    public enum Instance {
        INSTANCE;

        DataHolder instance;

        Instance() {
            instance = new DataHolder();
        }
    }

    public static DataHolder getInstance() {
        return Instance.INSTANCE.instance;
    }

    HashMap<String, List<VideoEntity>> datasMap = new HashMap<>();

    public void addDatas(String key, List<VideoEntity> datas) {
        if (datasMap.containsKey(key)) {
            List<VideoEntity> videoEntities = datasMap.get(key);
            videoEntities.addAll(datas);
        } else {
            datasMap.put(key, datas);
        }
    }

    public void setDatas(String key, List<VideoEntity> datas) {
        datasMap.put(key, datas);
    }

    public List<VideoEntity> getDatas(String key, int page, ICallback<List<VideoEntity>> resp) {
        return null;
    }
}
